/**
 * Copyright (c) 2006-2016 Huize Ltd. All Rights Reserved. 
 *  
 * This code is the confidential and proprietary information of   
 * Hzins. You shall not disclose such Confidential Information   
 * and shall use it only in accordance with the terms of the agreements   
 * you entered into with Huize,http://www.huize.com.
 *  
 */   
package com.agan.concurrent.lock; 

/**
 * @author	hz1412988 
 * @date	2018年2月9日 下午2:08:42
 * @version      
 */
public class Taxi {  
    private Point location,destination;  
    private final Dispatcher dispatcher;  
  
    public Taxi(Dispatcher dispatcher){  
        this.dispatcher = dispatcher;  
    }  
    public synchronized Point getLocation(){  
        return location;  
    }  
    public synchronized void setLocation(Point location){  
        this.location = location;  
    if (location.equals(destination)){  
        dispatcher.notifyAvailable(this);  
    }  
    }  
 